<template>
  <div>
    <h1>共享状态</h1>
    <h1>{{ count }}</h1>
    <h1>{{ oddOrEven }}</h1>
    <button @click="add">加法</button>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';

import { useCounter } from '@/store/index';
import { storeToRefs } from 'pinia';

export default defineComponent({
  setup() {
    console.log(useCounter());
    const store = useCounter();
    console.log(store);
    const { count, oddOrEven } = storeToRefs(store);
    console.log(count, oddOrEven);
    const { add } = store;



    return {
      count,
      oddOrEven,
      add,
    };
  },
});
</script>

<style scoped>

</style>
